-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Boundary Fields #159
base: master
Are you sure you want to change the base?
Conversation
I would use Geonames Importing other sources of boundary data is probably going to be more involved. I'll look into that. |
I thought I configured Travis to run our tests all pull requests, but that option was turned off. I've turned it back on. If you push any more to this pull request, it should run the tests automatically against Python 2.7, 3.3-3.6 and on Django 1.7-1.10. I'll be adding tests with Django 1.11 Real Soon Now (tm); no later than its official release. |
Closing and reopening to try to kickoff a Travis run. |
@george-silva If you don't want to push any more commits, but want to run Travis tests, it may work if you close and reopen this PR. I don't really have time right now to debug why Travis isn't working, but it's something I'll focus on fixing tonight or tomorrow. |
This repo has some of the GeoJSON files we need for the US: https://github.com/jgoodall/us-maps/tree/master/geojson The original source for those files also has information for "Urban Areas" and "Consolidated Cities" from the 2000 & 2010 US census: http://www.census.gov/geo/maps-data/data/tiger-line.html I'm still looking around for sources for info for other countries. |
Hello @blag! I think the geonames source for countries will work out just fine. I'll check today if OSM has the state/city data. thanks for the tip regarding Travis. I'll keep an eye on it. |
@george-silva Sorry, I wasn't clear: yep, I agree, let's use the Geonames data for countries, period. For boundaries of country subdivisions (eg: regions and below), I would also like to use OSM data wherever possible - it's comprehensive (international), highly precise, clearly licensed, and legally unencumbered. Check out these per-country boundary files: https://mapzen.com/data/borders/ We could only import boundaries for selected countries using all of those dumps, or we could download the entire planet file if all boundaries are chosen. The OSM wiki has a good explanation on administrative levels: https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative and if I'm reading that correctly, it means we could pick out boundaries for regions, subregions, cities, and districts from a single boundary file. I'm still not sure where we could get postal code areas for countries. That's where that source comes in. The |
@blag well, I guess the conjunction between the OSM wiki + mapzen's data will suffice. The hard part is do organize the data that is in the wiki. Here's my proposal for this: We have:
Something like: CITIES_BOUNDARY_MAPPING = {
# country code, list of administrative levels that correspond with our proposed boundary
'bra': [4,8],
'foo': [3,6]
}
# or
CITIES_BOUNDARY_MAPPING = {
# country code, list of administrative levels that correspond with our proposed boundary
'bra': {'region': 4, 'city': 8},
# etc
} If you check the docs from OSM's wiki, you can see that 4 in Brazil corresponds to states and 8 to cities. In this way we can download and use the correct data and we don't need to map out all of the countries upfront. We can let other users add their own mappings. And if it's a settings, they don't even need to PR, they can configure it for their project. The downside of this approach is that we require an extra conf. step and if the user wants to use different administrative regions (in Brazil's case he wants to use regions, states and macro-regions) we won't be able to do it. What do you think about that? |
That all sounds good, I would like to make sure we have good default options, to minimize the number of options people have to change. |
We may be able to use Zillow's data for http://www.zillow.com/howto/api/neighborhood-boundaries.htm Although the CC-BY-SA 3.0 license may not work for some of our users. I'm not trying to focus just on the US, but it doesn't seem that there is high quality corresponding data for other countries. |
And this may work for cities:
|
@blag quattroshapes is interesting. I've downloaded quattroshapes and I've downloaded the mapzen's country data to check them out. Findings:
Which data is best
Import strategies
Suggestions? Considerations? I wanted to look at the options first beforing writing any code. Just to be clear, my preference: OSM/Mapzen. It will be trickier but I think it's a good source, configurable, etc. |
@blag this might be better (also from Mapzen): https://whosonfirst.mapzen.com/ |
Who's On First is the successor to Quaatroshapes and includes neighbourhoods and postal codes. Mapzen has multiple staff working on the project, it's seen huge progress the last 18 months. There are multiple download options (metafiles, bundles). Please let us know how we can be of help. |
We import the geonameid as the primary key for continents, countries, regions, subregions, cities, and alternative names. For some reason that doesn't hold true for districts, even though the data source includes that information. At this point I want to stay backwards compatible for existing users, but I have been thinking of eventually creating a release that isn't backwards compatible, and one of the changes I want to make is to use their geonameid as their id. The rest sounds good. @nvkelso Awesome, thanks for all of your hard work! It would help us if you included the geonameids in your data, and separated your data by country so we only need to download/import the minimum amount of data. |
Metafiles have country ids so you can filter and download.
Geonames ids are in the concordances lists.
… On Feb 2, 2017, at 16:30, blag ***@***.***> wrote:
@george-silva
We import the geonameid as the primary key for continents, countries, regions, subregions, cities, and alternative names. For some reason that doesn't hold true for districts, even though the data source includes that information. At this point I want to stay backwards compatible for existing users, but I have been thinking of eventually creating a release that isn't backwards compatible, and one of the changes I want to make is to use their geonameid as their id.
The rest sounds good.
@nvkelso Awesome, thanks for all of your hard work! It would help us if you included the geonameids in your data, and separated your data by country so we only need to download/import the minimum amount of data.
―
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ok, I've managed to understand whos' on first data. What we'll need here is to:
Quite involved process 😄 I'll start some new modules to do all this work. |
We're also experimenting with "bundles" per placetype (but downloads for entire planet): |
@george-silva Sounds good, thanks for taking this on. ❤️ @coderholic Do you have any advice/recommendations for us? |
Hello guys. I'll be at a customers office and this might take a while to get done. I'm still up for it, but this week might be a little busy. |
Whoops, I hit the wrong button there. Sorry I haven't been attentive lately - job interviews. I should have some free time to check this out next week. |
@blag no problem. I'll get back to this next week. These two past weeks I have been traveling extensively. |
@george-silva This looks good so far, except for the changes in I'm still interviewing for jobs, but I might have time to flesh out the import script a bit more in the next few weeks. |
@@ -86,6 +88,8 @@ def save(self, *args, **kwargs): | |||
class BaseContinent(Place, SlugModel): | |||
code = models.CharField(max_length=2, unique=True, db_index=True) | |||
|
|||
objects = models.GeoManager() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obsolete now!
Hello all, I've just started helping out with project maintenance and I'd like to ask, is this PR dead? If someone is still working on it I'll gladly keep it open but otherwise I'm going to close it to clean up dangling PRs. If I don't hear back by in the next 7 days I'll assume that this work has been abandoned. Thanks, Adam |
Goals
Considerations
Place
model, so all inheritors have the field as well.TODO
test_project.urls
totest_app.urls
- when trying to migrate the test_app would not findtest_project.urls
, so this is kinda of a fix;WSGI_APPLICATION
fromtest_project.wsgi.application
totest_app.wsgi.application
. Also kinda of a fix.Edit (by blag): Changed checklists into GitHub-flavored Markdown TODO list so it gets a progress bar in the PR list page